<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app">
        <button @click="isPerson = !isPerson">更换人物</button>
        <h1>{{isPerson?'鞠婧祎':'赵露思'}}</h1>
        <img :src="url" width="400px">
    </div>
    <script>
        const vm = new Vue({
            el: '#app',
            data() {
                return {
                    isPerson:true,
                    url:'./j1.webp'
                }
            },
            watch:{
                isPerson:{
                    handler(newPerson,oldPerson){
                        // console.log(newPerson,oldPerson);
                        this.url=newPerson?'./j1.webp':'./l3.webp'
                    }
                }
            }
        })
    </script>
</body>

</html>